package day03_Socket;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashSet;
import java.util.Set;

public class Socket_server {
    public static HashSet<Socket> hs = new HashSet<>();;
    private static ServerSocket serverSocket = null;
    public static void main(String[] args) {
        try {
            serverSocket= new ServerSocket(3232);
            System.out.println("服务器启动成功");
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("服务器启动失败");
        }
        try {

            while(true) {
                Socket accept = serverSocket.accept();

                hs.add(accept);

                Server_Thread st = new Server_Thread(accept);
                st.start();
            }
        } catch (IOException e) {
        }


    }

}
